//sku模块接口管理
import request from "@/utils/request.ts";
import {SkuResponseData,SkuInfoData} from './type.ts'
enum API{
    SKU_URL='/admin/product/list/',//获取sku
    SALE_URL='/admin/product/onSale/',//上架
    CANCELSALE_URL='/admin/product/cancelSale/',//下架
    SKUINFO_URL='/admin/product/getSkuInfo/',//获取商品详情的接口
    DELETESKU_URL='/admin/product/deleteSku/',//删除已有的商品
}
/**
 * 获取sku
 * @param page
 * @param limit
 */
export const reqSkuList = (page:number,limit:number) => {
  return request.get<any,SkuResponseData>(API.SKU_URL+`${page}/${limit}`)
}
/**
 * sku上架
 * @param skuId
 */
export const reqSaleSku = (skuId:number) => {
  return request.get<any>(API.SALE_URL+skuId)
}
/**
 * sku下架
 * @param skuId
 */
export const reqCancelSale = (skuId:number) => {
  return request.get<any,any>(API.CANCELSALE_URL+skuId)
}
/**
 * 获取商品详情
 * @param skuId
 */
export const reqSkuInfo=(skuId:number)=>{
    return request.get<any,SkuInfoData>(API.SKUINFO_URL+skuId)
}
/**
 * 删除一个sku
 * @param skuId
 */
export const reqRemoveSku = (skuId:number) => {
  return request.delete<any,any>(API.DELETESKU_URL+skuId)
}